We are migrating the bug tracker to github Issues. This is now the preferred way to report NASM bugs.

Self-registration is disabled due to spam issue (mail gorcunov@gmail.com or hpa@zytor.com to create an account)

Bug 3392893 - Empty %rep block in mmacro causes an assertion failure panic
Summary: Empty %rep block in mmacro causes an assertion failure panic
Status: CLOSED FIXED
Alias: None
Product: NASM
Classification: Unclassified
Component: Assembler (show other bugs)
Version: 2.16.xx
Hardware: All All
: High major
Assignee: nobody
URL:
Depends on:
Blocks:
 
Reported: 2023-07-20 13:29 PDT by E. C. Masloch
Modified: 2023-10-13 20:55 PDT (History)
4 users (show)

Obtained from: Built from git using configure
Generated by: Human
Bug category: Invalid main output
Observed for: Invalid input
Regression: ---
Regression since:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description E. C. Masloch 2023-07-20 13:29:01 PDT
In this test the "nasm" executable is as patched in https://bugzilla.nasm.us/show_bug.cgi?id=3392892

The "orignasm" executable is https://github.com/netwide-assembler/nasm/commit/a916e4127b2eaa3bf40bddf3de9b0ceefc0d98a4

The bug is trivial to avoid as even a blank line between the %rep and %endrep is enough to avoid the panic. Any other content also seems to work.


test/20230720.2$ cat test1.asm
%macro mmac 0
%rep 1

%endrep
%endmacro

mmac
test/20230720.2$ cat test2.asm
%macro mmac 0
%rep 1
%endrep
%endmacro

mmac
test/20230720.2$ orignasm -v
NASM version 2.17rc0 compiled on Jul 20 2023
test/20230720.2$ orignasm test1.asm
test/20230720.2$ orignasm test2.asm
panic: test2.asm:6: assertion fm == istk->mstk.mstk failed at asm/preproc.c:7568
test/20230720.2$ nasm -v
NASM version 2.17rc0 compiled on Jul 20 2023
test/20230720.2$ nasm test1.asm
test/20230720.2$ nasm test2.asm
panic: test2.asm:6: assertion fm == istk->mstk.mstk failed at asm/preproc.c:7568
test/20230720.2$
Comment 1 H. Peter Anvin 2023-10-13 20:55:50 PDT
Fix checked in, thank you!